package com.ztesoft.huangfu.learning.springboot.es.document;

import java.util.Date;

/**
 * 　* Author: huangfu.daohui
 * 　* Date: 2018/12/18 20:14
 * 　* Description: 构建StudentDoc对象
 **/
public class StudentDocBuilder {

    private static StudentDoc studentDoc = null;

    public static StudentDocBuilder create() {
        studentDoc = new StudentDoc();
        return new StudentDocBuilder();
    }

    public StudentDocBuilder addId(String id) {
        studentDoc.setId(id);
        return this;
    }

    public StudentDocBuilder addName(String name) {
        studentDoc.setName(name);
        return this;
    }

    public StudentDocBuilder addSex(String sex) {
        studentDoc.setSex(sex);
        return this;
    }

    public StudentDocBuilder addAge(int age) {
        studentDoc.setAge(age);
        return this;
    }

    public StudentDocBuilder addIsInSchool(boolean isInSchool) {
        studentDoc.setInSchoolFlag(isInSchool);
        return this;
    }

    public StudentDocBuilder addHomeTown(String homeTown) {
        studentDoc.setHomeTown(homeTown);
        return this;
    }

    public StudentDocBuilder addTelNo(long telNo) {
        studentDoc.setTelNo(telNo);
        return this;
    }

    public StudentDocBuilder addBirthday(long birthday) {
        studentDoc.setBirthday(birthday);
        return this;
    }

    public StudentDocBuilder addDescribe(String describe) {
        studentDoc.setDescribe(describe);
        return this;
    }

    public StudentDoc builder() {
        return studentDoc;
    }

    public static void main(String[] args) {
        StudentDoc stu = StudentDocBuilder.create()
                .addId(System.currentTimeMillis() + "01")
                .builder();
        System.out.println(stu.getId());
    }
}
